Commit Graph

38 Commits

Author SHA1 Message Date
ee9e7a7e5b quota: ensure that names of structure fields are printed properly
* quota.c (PRINT_FIELD_D, PRINT_FIELD_U, PRINT_FIELD_X): New macros.
(decode_cmd_data): Use them to print structure fields.
2016-09-27 01:08:38 +00:00
340909fd00 quota: move Q_QUOTAON handling to subcommand switch statement
* quota.c (SYS_FUNC(quotactl)): Move handling of Q_QUOTAON subcommand ...
(decode_cmd_data): ... here.
2016-09-27 00:57:28 +00:00
Eugene Syromyatnikov
fd5195dccd quota: remove legacy subcommand decoding support code
Support for these quota subcommands by linux kernels has been dropped
long time ago (between 2.5.16 and 2.5.17), so lets drop it in order
to minimize amount of code which should be subjected to testing and
structured conversion.

* quota.c (struct v1_dqblk, struct v2_dqblk, struct v2_dqinfo,
struct v1_dqstats, struct v2_dqstats): Remove.
(decode_cmd_data): Remove handling of Q_V1_GETQUOTA, Q_V1_SETQUOTA,
Q_V2_GETQUOTA, Q_V2_SETQUOTA, Q_V2_GETINFO, Q_V2_SETINFO, Q_V1_GETSTATS,
and Q_V2_GETSTATS subcommands.
(SYS_FUNC(quotactl)): Remove handling of Q_V1_QUOTAON subcommand.
2016-09-27 00:57:28 +00:00
Eugene Syromyatnikov
abde34546d quota: add realtime block limits fields to XFS disk quota printing code
* quota.c (decode_cmd_data): Add printing of d_rtb_hardlimit
and d_rtb_softlimit fields to struct xfs_dqblk printing code.
2016-09-27 00:57:27 +00:00
Eugene Syromyatnikov
46b89571f5 quota: add packed attribute to struct if_dqblk definition
Since the only difference between 32-bit and 64-bit environments
regarding this structure is its padding, lets just add packed attribute
to its definition instead of going full mpers.

* quota.c (struct if_dqblk): Add ATTRIBUTE_PACKED.
2016-09-27 00:57:27 +00:00
Eugene Syromyatnikov
4cb1124902 quota: Add decoding for Q_XQUOTARM subcommand
* quota.c (decode_cmd_data): Add Q_XQUOTARM handling to subcommand
  switch.
2016-09-27 00:57:27 +00:00
Eugene Syromyatnikov
01bb1d206a quota: add dispatch of SYNC subcommands
Q_XQUOTASYNC is no-op, but it does not require id/addr arguments anyway.

* quota.c (decode_cmd_data): Add Q_SYNC and Q_XQUOTASYNC to subcommand
dispatch switch since id/addr arguments for these subcommands are known
to be ignored.
2016-09-27 00:57:27 +00:00
Eugene Syromyatnikov
3b3fd71546 quota: add missing prefixes to struct field names
* quota.c (decode_cmd_data): Print field names in accordance with
their definition.
2016-09-27 00:57:27 +00:00
Eugene Syromyatnikov
f8b50ef4ea quota: fix indentation inside subcommand dispatching switch statement 2016-09-27 00:57:20 +00:00
Eugene Syromyatnikov
51330fd434 quota: avoid printing id argument for those commands that ignore it
As id argument is not used for Q_QUOTAOFF, Q_GETFMT, Q_V2_GETINFO,
Q_GETINFO, Q_V2_SEETINFO, Q_SETINFO, Q_SYNC, Q_XQUOTAON, Q_XQUOTAOFF,
Q_XQUOTARM, Q_XGETQSTAT, Q_XGETQSTATV, Q_XQUOTASYNC, Q_V1_GETSTATS, and
Q_V2_GETSTATS subcommands, do not print it for these subcommands.

* quota.c (decode_cmd_data): Add id argument parameter, add printing
of id argument for Q_GETQUOTA, Q_SETQUOTA, Q_GETNEXTQUOTA,
Q_V1_GETQUOTA, Q_V1_SETQUOTA, Q_V2_GETQUOTA, Q_V2_SETQUOTA,
Q_XGETQUOTA, Q_XGETNEXTQUOTA, Q_XSETQLIM, and unknown subcommands.
(SYS_FUNC(quotactl)): Remove printing of id argument, pass it
to decode_cmd_data.
2016-09-27 00:57:20 +00:00
Eugene Syromyatnikov
e87379b820 quota: use printuid for id parameter printing
* quota.c (SYS_FUNC(quotactl)): Since id call argument is used for
user/group/project ID which all have special semantics for -1,
print it the same way as UIDs are printed.
2016-09-27 00:57:20 +00:00
Eugene Syromyatnikov
0cda3e0823 quota: display quota subcommand as a macro
* quota.c (SYS_FUNC(quotactl)): Replace disjunction of two xlat values
(which also lacks shift of the left part) with QCMD macro call.
2016-09-27 00:57:14 +00:00
f77ca9ca71 Fix printing of invalid struct xfs_dqblk.d_flags
* quota.c (decode_cmd_data): Explicitly cast struct xfs_dqblk.d_flags
to uint8_t to avoid potential sign-extension bug when printing
invalid struct xfs_dqblk.d_flags.
2016-05-16 22:41:20 +00:00
cca2e53c4a quotactl: add decoding of Q_GETNEXTQUOTA and Q_XGETNEXTQUOTA
* quota.c (if_nextdqblk): New structure.
(decode_cmd_data): Handle Q_GETNEXTQUOTA and Q_XGETNEXTQUOTA.
2016-03-29 01:15:24 +00:00
ed227111a4 quotactl: add Q_XGETQSTATV command decoding
* quota.c (fs_qfilestatv, fs_quota_statv): New structures.
(decode_cmd_data): Handle Q_XGETQSTATV case.
2016-01-19 23:48:36 +00:00
60d4892866 quotactl: add decoding of if_dqinfo.dqi_flags constants
* xlat/if_dqinfo_flags.in: New file.
* quota.c: Include "xlat/if_dqinfo_flags.h".
(decode_cmd_data): Print struct if_dqinfo.dqi_flags using printflags.
2016-01-19 02:10:23 +00:00
c02fd6109a quotactl: consistenly decode all write and unknown commands on entering
* quota.c (decode_cmd_data): Change return type to int.
Return 0 on entering Q_GETQUOTA, Q_V1_GETQUOTA, Q_V2_GETQUOTA,
Q_XGETQUOTA, Q_GETFMT, Q_GETINFO, Q_V2_GETINFO, Q_V1_GETSTATS,
Q_V2_GETSTATS, and Q_XGETQSTAT commands, return RVAL_DECODED
for any other command.
(SYS_FUNC(quotactl)): On entering, print third argument of any command.
For any command except Q_QUOTAON and Q_V1_QUOTAON, call decode_cmd_data
and forward its return value.
2016-01-19 02:00:20 +00:00
b176920bb7 quotactl: fix Q_QUOTAON command decoding
* quota.c (SYS_FUNC(quotactl)): Print Q_QUOTAON 4th argument as a path.
2016-01-19 01:43:24 +00:00
7258d27e9c quotactl: print third argument as unsigned int
* quota.c (SYS_FUNC(quotactl)): Consistently print the third
argument using "%u" format.
2016-01-19 01:43:24 +00:00
7ea48d6ff8 quotactl: fix Q_XQUOTAOFF command decoding
* quota.c (decode_cmd_data): Print xfs quota flags argument.
2016-01-19 01:43:17 +00:00
6a9ac9636a quotactl: fix Q_GETFMT and Q_XQUOTAON commands decoding
* quota.c (decode_cmd_data): As quota format value and xfs quota flags
are in-memory constants, print it like an array of one element instead
of a structure.
2016-01-19 01:42:08 +00:00
0894194648 Replace u_int{8,16,32,64} with uint{8,16,32,64}
* util.c: Replace u_int{32,64} with uint{32,64}.
* quota.c: Replace u_int{8,16,32,64} with uint{8,16,32,64}.
2016-01-19 00:28:38 +00:00
2105a9737c Move definitions of quotactl constants to xlat files
* quota.c (Q_*): Move to xlat/quotacmds.in.
(USRQUOTA, GRPQUOTA): Move to xlat/quotatypes.in.
(QFMT_VFS_OLD, QFMT_VFS_V0): Move to xlat/quota_formats.in.
(XFS_QUOTA_*): Move to xlat/xfs_quota_flags.in.
(XFS_*_QUOTA): Move to xlat/xfs_dqblk_flags.in.
(QIF_*): Move to xlat/if_dqblk_valid.in.
(IIF_*): Move to xlat/if_dqinfo_valid.in.
2016-01-19 00:06:09 +00:00
0564623abf Enhance quotactl decoding
* quota.c (decode_cmd_data): Use umove_or_printaddr.
(sys_quotactl): Do not disable the parser in verbose mode.
Decode all "set" commands on entering syscall.
2015-07-18 00:01:40 +00:00
a0bd3749fc Declare syscall parsers using SYS_FUNC macro
Introduce SYS_FUNC macro to declare and define all syscall parsers.

* Makefile.am (BUILT_SOURCES, CLEANFILES): Add sys_func.h.
(sys_func.h): New rule.
* defs.h (SYS_FUNC_NAME, SYS_FUNC): New macros.
* linux/syscall.h: Include "sys_func.h".
[NEED_UID16_PARSERS]: Use SYS_FUNC to declare uid16 syscall parsers.
Remove other declarations.
* linux/alpha/syscallent.h (160, 161): Add sys_ prefix to osf_statfs
and osf_fstatfs syscall parsers.
* *.c: Use SYS_FUNC to define syscall parsers.
2015-04-07 11:22:49 +00:00
d35bdcad13 Compress blank lines
Suppress empty lines left after automated xlat conversion.
2014-05-30 22:10:21 +00:00
0ed617bd66 Generate xlat/*.in files
Automatically convert xlat structures from *.c files to xlat/*.in files
using "./generate_xlat_in.sh *.c" command.
2014-05-30 21:40:03 +00:00
5945273533 Use XLAT_END macro
Automatically update all xlat structures using the following sed regexp:
s/^[[:space:]]*{[[:space:]]*0[[:space:]]*,[[:space:]]*NULL[[:space:]]*,\?[[:space:]]*}[[:space:]]*,\?[[:space:]]*/\tXLAT_END/
2014-02-05 02:28:18 +00:00
bce0cc6a2d Use XLAT macro
Automatically convert all xlat structures to XLAT form
using the following sed regexp:
s/^[[:space:]]*{[[:space:]]*\([^",}[:space:]]\+\)[[:space:]]*,[[:space:]]*"\1",\?[[:space:]]*}[[:space:]]*/\tXLAT(\1)/
2014-02-05 01:33:50 +00:00
7943966f6c Enhance quotactl decoding
* quota.c (sys_quotactl): Decode 2nd syscall argument using printpath.
* pathtrace.c (pathtrace_match): Add quotactl support.
* linux/*/syscallent.h: Add TF flag to quotactl entry.
2012-10-26 23:43:13 +00:00
Denys Vlasenko
a6d91ded3f Tidy up includes and copyright notices, fix indentation
The files not mentioned in changelog below had only
copyright notices fixes and indentation fixes.

* defs.h: Include <stdint.h> and <inttypes.h>.
* file.c: Do not include <inttypes.h>.
Move struct kernel_dirent declaration below top include block.
* block.c: Do not include <stdint.h> and <inttypes.h>.
* quota.c: Likewise.
* desc.c: Likewise.
* signal.c: Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-16 12:02:22 +01:00
e83e157021 Compress blank lines
Suppress repeated empty lines left after automated code removal.
This change was made by filtering every source code file through
"cat -s".
2012-02-25 15:41:21 +00:00
Denys Vlasenko
1a3cf10c30 Build fixes after non-Linux code removal
* configure.ac: Remove calls to proc-based ptrace checks.
* proc.c: Remove, it's empty now.
* Makefile.am: Remove reference to proc.c.
* net.c: Remove trailing newlines.
* quota.c: Likewise
* resource.c: Likewise
* strace.c: Likewise
* stream.c: Likewise
* time.c: Likewise

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-02-25 02:54:34 +01:00
Denys Vlasenko
ed720fda5d Automated removal of non-Linux code
This change is generated by running every source through the following command:

unifdef -DLINUX -Dlinux -USUNOS4 -USVR4 -UUNIXWARE -UFREEBSD
-USUNOS4_KERNEL_ARCH_KLUDGE -UHAVE_MP_PROCFS
-UHAVE_POLLABLE_PROCFS -UHAVE_PR_SYSCALL -UUSE_PROCFS file.c

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-02-25 02:24:03 +01:00
H.J. Lu
0b315b6543 Cast to long for %l in printf
Cast a value to long for %l in printf to avoid compiler warning
on systems where it may be long long.

* count.c (call_summary_pers): Cast to long.
* ipc.c (sys_mq_open, printmqattr): Likewise.
* quota.c (decode_cmd_data): Likewise.
* resource.c (sys_sysinfo): Likewise.
* time.c (tprint_timex): Likewise.
2012-02-06 13:33:54 +00:00
Denys Vlasenko
60fe8c139c Use tprints with literal strings, it may be faster than tprintf
* bjm.c: Replace tprintf("str") with tprints("str").
* block.c: Likewise.
* desc.c: Likewise.
* file.c: Likewise.
* io.c: Likewise.
* ipc.c: Likewise.
* mem.c: Likewise.
* net.c: Likewise.
* proc.c: Likewise.
* process.c: Likewise.
* quota.c: Likewise.
* resource.c: Likewise.
* scsi.c: Likewise.
* signal.c: Likewise.
* sock.c: Likewise.
* strace.c: Likewise.
* stream.c: Likewise.
* syscall.c: Likewise.
* system.c: Likewise.
* term.c: Likewise.
* time.c: Likewise.
* util.c: Likewise.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-09-01 10:00:28 +02:00
Denys Vlasenko
7b609d5ba0 Whitespace cleanups. No code changes.
* count.c: Place opening curly brace after if (),
  not on the next line. Almost all strace code alredy
  uses this style.
* desc.c: Likewise.
* file.c: Likewise.
* net.c: Likewise.
* pathtrace.c: Likewise.
* process.c: Likewise.
* quota.c: Likewise.
* signal.c: Likewise.
* strace.c: Likewise.
* syscall.c: Likewise.
* time.c: Likewise.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-06-22 14:32:43 +02:00
ef5c3d657d 2006-10-16 Dmitry V. Levin <ldv@altlinux.org>
Implement comprehensive quotactl(2) parser for Linux.
	* Makefile.am (strace_SOURCES): Add quota.c.
	* quota.c: New file.
	* resource.c: Remove old quotactl(2) parser.
	Fixes RH#118696.
2006-10-16 00:26:47 +00:00