2006-10-16 04:26:47 +04:00
/*
* Copyright ( c ) 1991 , 1992 Paul Kranenburg < pk @ cs . few . eur . nl >
* Copyright ( c ) 1993 Branko Lankester < branko @ hacktic . nl >
* Copyright ( c ) 1993 , 1994 , 1995 , 1996 Rick Sladkey < jrs @ world . std . com >
* Copyright ( c ) 1996 - 1999 Wichert Akkerman < wichert @ cistron . nl >
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 04:15:49 +03:00
* Copyright ( c ) 2005 - 2016 Dmitry V . Levin < ldv @ altlinux . org >
2017-09-05 11:01:01 +03:00
* Copyright ( c ) 2006 - 2017 The strace developers .
2006-10-16 04:26:47 +04:00
* All rights reserved .
*
* Redistribution and use in source and binary forms , with or without
* modification , are permitted provided that the following conditions
* are met :
* 1. Redistributions of source code must retain the above copyright
* notice , this list of conditions and the following disclaimer .
* 2. Redistributions in binary form must reproduce the above copyright
* notice , this list of conditions and the following disclaimer in the
* documentation and / or other materials provided with the distribution .
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission .
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ` ` AS IS ' ' AND ANY EXPRESS OR
* IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED .
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT , INDIRECT ,
* INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT
* NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE ,
* DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT
* ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE .
*/
# include "defs.h"
2017-07-01 16:14:49 +03:00
# include "print_fields.h"
2006-10-16 04:26:47 +04:00
# define SUBCMDMASK 0x00ff
# define SUBCMDSHIFT 8
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-17 01:50:09 +03:00
# define QCMD_CMD(cmd) ((uint32_t)(cmd) >> SUBCMDSHIFT)
# define QCMD_TYPE(cmd) ((uint32_t)(cmd) & SUBCMDMASK)
2006-10-16 04:26:47 +04:00
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-17 01:50:09 +03:00
# define OLD_CMD(cmd) ((uint32_t)(cmd) << SUBCMDSHIFT)
# define NEW_CMD(cmd) ((uint32_t)(cmd) | 0x800000)
# define XQM_CMD(cmd) ((uint32_t)(cmd) | ('X' << SUBCMDSHIFT))
2006-10-16 04:26:47 +04:00
2014-04-26 03:30:54 +04:00
# include "xlat/quotacmds.h"
# include "xlat/quotatypes.h"
# include "xlat/quota_formats.h"
# include "xlat/xfs_quota_flags.h"
# include "xlat/xfs_dqblk_flags.h"
# include "xlat/if_dqblk_valid.h"
2016-01-19 05:10:23 +03:00
# include "xlat/if_dqinfo_flags.h"
2016-01-17 01:50:09 +03:00
# include "xlat/if_dqinfo_valid.h"
2006-10-16 04:26:47 +04:00
2016-09-21 06:12:01 +03:00
/*
* We add attribute packed due to the fact that the structure is 8 - byte aligned
* on 64 - bit systems and therefore has additional 4 bytes of padding , which
* leads to problems when it is used on 32 - bit tracee which does not have such
* padding .
*/
2017-06-18 01:23:09 +03:00
struct if_dqblk {
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-17 01:50:09 +03:00
uint64_t dqb_bhardlimit ;
uint64_t dqb_bsoftlimit ;
uint64_t dqb_curspace ;
uint64_t dqb_ihardlimit ;
uint64_t dqb_isoftlimit ;
uint64_t dqb_curinodes ;
uint64_t dqb_btime ;
uint64_t dqb_itime ;
uint32_t dqb_valid ;
2016-09-21 06:12:01 +03:00
} ATTRIBUTE_PACKED ;
2006-10-16 04:26:47 +04:00
2016-03-29 04:15:24 +03:00
struct if_nextdqblk {
uint64_t dqb_bhardlimit ;
uint64_t dqb_bsoftlimit ;
uint64_t dqb_curspace ;
uint64_t dqb_ihardlimit ;
uint64_t dqb_isoftlimit ;
uint64_t dqb_curinodes ;
uint64_t dqb_btime ;
uint64_t dqb_itime ;
uint32_t dqb_valid ;
uint32_t dqb_id ;
} ;
2017-06-18 01:23:09 +03:00
struct xfs_dqblk {
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-17 01:50:09 +03:00
int8_t d_version ; /* version of this structure */
2017-07-01 23:08:39 +03:00
uint8_t d_flags ; /* XFS_{USER,PROJ,GROUP}_QUOTA */
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-17 01:50:09 +03:00
uint16_t d_fieldmask ; /* field specifier */
uint32_t d_id ; /* user, project, or group ID */
uint64_t d_blk_hardlimit ; /* absolute limit on disk blks */
uint64_t d_blk_softlimit ; /* preferred limit on disk blks */
uint64_t d_ino_hardlimit ; /* maximum # allocated inodes */
uint64_t d_ino_softlimit ; /* preferred inode limit */
uint64_t d_bcount ; /* # disk blocks owned by the user */
uint64_t d_icount ; /* # inodes owned by the user */
int32_t d_itimer ; /* zero if within inode limits */
int32_t d_btimer ; /* similar to above; for disk blocks */
uint16_t d_iwarns ; /* # warnings issued wrt num inodes */
uint16_t d_bwarns ; /* # warnings issued wrt disk blocks */
int32_t d_padding2 ; /* padding2 - for future use */
uint64_t d_rtb_hardlimit ; /* absolute limit on realtime blks */
uint64_t d_rtb_softlimit ; /* preferred limit on RT disk blks */
uint64_t d_rtbcount ; /* # realtime blocks owned */
int32_t d_rtbtimer ; /* similar to above; for RT disk blks */
uint16_t d_rtbwarns ; /* # warnings issued wrt RT disk blks */
int16_t d_padding3 ; /* padding3 - for future use */
char d_padding4 [ 8 ] ; /* yet more padding */
2006-10-16 04:26:47 +04:00
} ;
2017-06-18 01:23:09 +03:00
struct if_dqinfo {
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-17 01:50:09 +03:00
uint64_t dqi_bgrace ;
uint64_t dqi_igrace ;
uint32_t dqi_flags ;
uint32_t dqi_valid ;
2006-10-16 04:26:47 +04:00
} ;
2017-06-18 01:23:09 +03:00
typedef struct fs_qfilestat {
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-17 01:50:09 +03:00
uint64_t qfs_ino ; /* inode number */
uint64_t qfs_nblks ; /* number of BBs 512-byte-blks */
uint32_t qfs_nextents ; /* number of extents */
2006-10-16 04:26:47 +04:00
} fs_qfilestat_t ;
2017-06-18 01:23:09 +03:00
struct xfs_dqstats {
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-17 01:50:09 +03:00
int8_t qs_version ; /* version number for future changes */
uint16_t qs_flags ; /* XFS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */
int8_t qs_pad ; /* unused */
2006-10-16 04:26:47 +04:00
fs_qfilestat_t qs_uquota ; /* user quota storage information */
fs_qfilestat_t qs_gquota ; /* group quota storage information */
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-17 01:50:09 +03:00
uint32_t qs_incoredqs ; /* number of dquots incore */
int32_t qs_btimelimit ; /* limit for blks timer */
int32_t qs_itimelimit ; /* limit for inodes timer */
2006-10-16 04:26:47 +04:00
int32_t qs_rtbtimelimit ; /* limit for rt blks timer */
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-17 01:50:09 +03:00
uint16_t qs_bwarnlimit ; /* limit for num warnings */
uint16_t qs_iwarnlimit ; /* limit for num warnings */
2006-10-16 04:26:47 +04:00
} ;
2016-01-20 00:48:59 +03:00
struct fs_qfilestatv {
uint64_t qfs_ino , qfs_nblks ;
uint32_t qfs_nextents , qfs_pad ;
} ;
struct fs_quota_statv {
int8_t qs_version ;
uint8_t qs_pad1 ;
uint16_t qs_flags ;
uint32_t qs_incoredqs ;
struct fs_qfilestatv qs_uquota ;
struct fs_qfilestatv qs_gquota ;
struct fs_qfilestatv qs_pquota ;
int32_t qs_btimelimit ;
int32_t qs_itimelimit ;
int32_t qs_rtbtimelimit ;
uint16_t qs_bwarnlimit ;
uint16_t qs_iwarnlimit ;
uint64_t qs_pad2 [ 8 ] ;
} ;
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 04:15:49 +03:00
static int
2016-12-26 13:26:03 +03:00
decode_cmd_data ( struct tcb * tcp , uint32_t id , uint32_t cmd , kernel_ulong_t data )
2006-10-16 04:26:47 +04:00
{
2011-06-22 16:32:43 +04:00
switch ( cmd ) {
2016-09-21 06:11:17 +03:00
case Q_QUOTAOFF :
2016-09-21 06:11:38 +03:00
case Q_SYNC :
case Q_XQUOTASYNC :
2016-09-21 06:11:17 +03:00
break ;
2016-09-26 22:03:52 +03:00
case Q_QUOTAON :
tprints ( " , " ) ;
printxval ( quota_formats , id , " QFMT_VFS_??? " ) ;
tprints ( " , " ) ;
printpath ( tcp , data ) ;
break ;
2016-09-21 06:11:17 +03:00
case Q_GETQUOTA :
if ( entering ( tcp ) ) {
printuid ( " , " , id ) ;
tprints ( " , " ) ;
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-21 06:11:09 +03:00
2016-09-21 06:11:17 +03:00
return 0 ;
}
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-21 06:11:09 +03:00
2016-09-21 06:11:17 +03:00
/* Fall-through */
case Q_SETQUOTA :
{
struct if_dqblk dq ;
2006-10-16 04:26:47 +04:00
2016-09-21 06:11:17 +03:00
if ( entering ( tcp ) ) {
printuid ( " , " , id ) ;
tprints ( " , " ) ;
2006-10-16 04:26:47 +04:00
}
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-21 06:11:09 +03:00
2016-09-21 06:11:17 +03:00
if ( umove_or_printaddr ( tcp , data , & dq ) )
2016-03-29 04:15:24 +03:00
break ;
2016-09-27 04:08:38 +03:00
PRINT_FIELD_U ( " { " , dq , dqb_bhardlimit ) ;
PRINT_FIELD_U ( " , " , dq , dqb_bsoftlimit ) ;
PRINT_FIELD_U ( " , " , dq , dqb_curspace ) ;
PRINT_FIELD_U ( " , " , dq , dqb_ihardlimit ) ;
PRINT_FIELD_U ( " , " , dq , dqb_isoftlimit ) ;
PRINT_FIELD_U ( " , " , dq , dqb_curinodes ) ;
2016-09-21 06:11:17 +03:00
if ( ! abbrev ( tcp ) ) {
2016-09-27 04:08:38 +03:00
PRINT_FIELD_U ( " , " , dq , dqb_btime ) ;
PRINT_FIELD_U ( " , " , dq , dqb_itime ) ;
2017-07-01 23:08:39 +03:00
PRINT_FIELD_FLAGS ( " , " , dq , dqb_valid ,
if_dqblk_valid , " QIF_??? " ) ;
2016-09-27 04:08:38 +03:00
} else {
tprints ( " , ... " ) ;
}
tprints ( " } " ) ;
2016-09-21 06:11:17 +03:00
break ;
}
case Q_GETNEXTQUOTA :
{
struct if_nextdqblk dq ;
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-21 06:11:09 +03:00
2016-09-21 06:11:17 +03:00
if ( entering ( tcp ) ) {
printuid ( " , " , id ) ;
tprints ( " , " ) ;
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-21 06:11:09 +03:00
2016-09-21 06:11:17 +03:00
return 0 ;
}
2006-10-16 04:26:47 +04:00
2016-09-21 06:11:17 +03:00
if ( umove_or_printaddr ( tcp , data , & dq ) )
2006-10-16 04:26:47 +04:00
break ;
2016-09-27 04:08:38 +03:00
PRINT_FIELD_U ( " { " , dq , dqb_bhardlimit ) ;
PRINT_FIELD_U ( " , " , dq , dqb_bsoftlimit ) ;
PRINT_FIELD_U ( " , " , dq , dqb_curspace ) ;
PRINT_FIELD_U ( " , " , dq , dqb_ihardlimit ) ;
PRINT_FIELD_U ( " , " , dq , dqb_isoftlimit ) ;
PRINT_FIELD_U ( " , " , dq , dqb_curinodes ) ;
2016-09-21 06:11:17 +03:00
if ( ! abbrev ( tcp ) ) {
2016-09-27 04:08:38 +03:00
PRINT_FIELD_U ( " , " , dq , dqb_btime ) ;
PRINT_FIELD_U ( " , " , dq , dqb_itime ) ;
2017-07-01 23:08:39 +03:00
PRINT_FIELD_FLAGS ( " , " , dq , dqb_valid ,
if_dqblk_valid , " QIF_??? " ) ;
2016-09-27 04:08:38 +03:00
PRINT_FIELD_U ( " , " , dq , dqb_id ) ;
} else {
PRINT_FIELD_U ( " , " , dq , dqb_id ) ;
tprints ( " , ... " ) ;
}
tprints ( " } " ) ;
2016-09-21 06:11:17 +03:00
break ;
}
case Q_XGETQUOTA :
case Q_XGETNEXTQUOTA :
if ( entering ( tcp ) ) {
printuid ( " , " , id ) ;
tprints ( " , " ) ;
2006-10-16 04:26:47 +04:00
2016-09-21 06:11:17 +03:00
return 0 ;
}
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-21 06:11:09 +03:00
2016-09-21 06:11:17 +03:00
/* Fall-through */
case Q_XSETQLIM :
{
struct xfs_dqblk dq ;
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-21 06:11:09 +03:00
2016-09-21 06:11:17 +03:00
if ( entering ( tcp ) ) {
printuid ( " , " , id ) ;
tprints ( " , " ) ;
2006-10-16 04:26:47 +04:00
}
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-21 06:11:09 +03:00
2016-09-21 06:11:17 +03:00
if ( umove_or_printaddr ( tcp , data , & dq ) )
break ;
2016-09-27 04:08:38 +03:00
PRINT_FIELD_D ( " { " , dq , d_version ) ;
2017-07-01 23:08:39 +03:00
PRINT_FIELD_FLAGS ( " , " , dq , d_flags ,
xfs_dqblk_flags , " XFS_???_QUOTA " ) ;
2016-09-27 04:08:38 +03:00
PRINT_FIELD_X ( " , " , dq , d_fieldmask ) ;
PRINT_FIELD_U ( " , " , dq , d_id ) ;
PRINT_FIELD_U ( " , " , dq , d_blk_hardlimit ) ;
PRINT_FIELD_U ( " , " , dq , d_blk_softlimit ) ;
PRINT_FIELD_U ( " , " , dq , d_ino_hardlimit ) ;
PRINT_FIELD_U ( " , " , dq , d_ino_softlimit ) ;
PRINT_FIELD_U ( " , " , dq , d_bcount ) ;
PRINT_FIELD_U ( " , " , dq , d_icount ) ;
2016-09-21 06:11:17 +03:00
if ( ! abbrev ( tcp ) ) {
2016-09-27 04:08:38 +03:00
PRINT_FIELD_D ( " , " , dq , d_itimer ) ;
PRINT_FIELD_D ( " , " , dq , d_btimer ) ;
PRINT_FIELD_U ( " , " , dq , d_iwarns ) ;
PRINT_FIELD_U ( " , " , dq , d_bwarns ) ;
PRINT_FIELD_U ( " , " , dq , d_rtb_hardlimit ) ;
PRINT_FIELD_U ( " , " , dq , d_rtb_softlimit ) ;
PRINT_FIELD_U ( " , " , dq , d_rtbcount ) ;
PRINT_FIELD_D ( " , " , dq , d_rtbtimer ) ;
PRINT_FIELD_U ( " , " , dq , d_rtbwarns ) ;
} else {
tprints ( " , ... " ) ;
}
tprints ( " } " ) ;
2016-09-21 06:11:17 +03:00
break ;
}
case Q_GETFMT :
{
uint32_t fmt ;
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-21 06:11:09 +03:00
2016-09-21 06:11:17 +03:00
if ( entering ( tcp ) ) {
tprints ( " , " ) ;
2006-10-16 04:26:47 +04:00
2016-09-21 06:11:17 +03:00
return 0 ;
}
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-21 06:11:09 +03:00
2016-09-21 06:11:17 +03:00
if ( umove_or_printaddr ( tcp , data , & fmt ) )
2006-10-16 04:26:47 +04:00
break ;
2016-09-21 06:11:17 +03:00
tprints ( " [ " ) ;
printxval ( quota_formats , fmt , " QFMT_VFS_??? " ) ;
tprints ( " ] " ) ;
break ;
}
case Q_GETINFO :
if ( entering ( tcp ) ) {
tprints ( " , " ) ;
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-21 06:11:09 +03:00
2016-09-21 06:11:17 +03:00
return 0 ;
}
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-21 06:11:09 +03:00
2016-09-21 06:11:17 +03:00
/* Fall-through */
case Q_SETINFO :
{
struct if_dqinfo dq ;
2006-10-16 04:26:47 +04:00
2016-09-21 06:11:17 +03:00
if ( entering ( tcp ) )
tprints ( " , " ) ;
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-21 06:11:09 +03:00
2016-09-21 06:11:17 +03:00
if ( umove_or_printaddr ( tcp , data , & dq ) )
2006-10-16 04:26:47 +04:00
break ;
2016-09-27 04:08:38 +03:00
PRINT_FIELD_U ( " { " , dq , dqi_bgrace ) ;
PRINT_FIELD_U ( " , " , dq , dqi_igrace ) ;
2017-07-01 23:08:39 +03:00
PRINT_FIELD_FLAGS ( " , " , dq , dqi_flags , if_dqinfo_flags , " DQF_??? " ) ;
PRINT_FIELD_FLAGS ( " , " , dq , dqi_valid , if_dqinfo_valid , " IIF_??? " ) ;
2016-09-21 06:11:17 +03:00
tprints ( " } " ) ;
break ;
}
case Q_XGETQSTAT :
{
struct xfs_dqstats dq ;
if ( entering ( tcp ) ) {
tprints ( " , " ) ;
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-21 06:11:09 +03:00
2016-09-21 06:11:17 +03:00
return 0 ;
}
if ( umove_or_printaddr ( tcp , data , & dq ) )
break ;
2016-09-27 04:08:38 +03:00
PRINT_FIELD_D ( " { " , dq , qs_version ) ;
if ( ! abbrev ( tcp ) ) {
2017-07-01 23:08:39 +03:00
PRINT_FIELD_FLAGS ( " , " , dq , qs_flags ,
xfs_quota_flags , " XFS_QUOTA_??? " ) ;
2016-09-27 04:08:38 +03:00
PRINT_FIELD_U ( " , " , dq , qs_incoredqs ) ;
PRINT_FIELD_U ( " , qs_uquota={ " , dq . qs_uquota , qfs_ino ) ;
PRINT_FIELD_U ( " , " , dq . qs_uquota , qfs_nblks ) ;
PRINT_FIELD_U ( " , " , dq . qs_uquota , qfs_nextents ) ;
PRINT_FIELD_U ( " }, qs_gquota={ " , dq . qs_gquota , qfs_ino ) ;
PRINT_FIELD_U ( " , " , dq . qs_gquota , qfs_nblks ) ;
PRINT_FIELD_U ( " , " , dq . qs_gquota , qfs_nextents ) ;
PRINT_FIELD_D ( " }, " , dq , qs_btimelimit ) ;
PRINT_FIELD_D ( " , " , dq , qs_itimelimit ) ;
PRINT_FIELD_D ( " , " , dq , qs_rtbtimelimit ) ;
PRINT_FIELD_U ( " , " , dq , qs_bwarnlimit ) ;
PRINT_FIELD_U ( " , " , dq , qs_iwarnlimit ) ;
} else {
tprints ( " , ... " ) ;
2016-01-20 00:48:59 +03:00
}
2016-09-27 04:08:38 +03:00
tprints ( " } " ) ;
2016-09-21 06:11:17 +03:00
break ;
}
case Q_XGETQSTATV :
{
struct fs_quota_statv dq ;
2006-10-16 04:26:47 +04:00
2016-09-21 06:11:17 +03:00
if ( entering ( tcp ) ) {
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-21 06:11:09 +03:00
tprints ( " , " ) ;
2016-09-21 06:11:17 +03:00
return 0 ;
}
if ( umove_or_printaddr ( tcp , data , & dq ) )
break ;
2016-09-27 04:08:38 +03:00
PRINT_FIELD_D ( " { " , dq , qs_version ) ;
if ( ! abbrev ( tcp ) ) {
2017-07-01 23:08:39 +03:00
PRINT_FIELD_FLAGS ( " , " , dq , qs_flags ,
xfs_quota_flags , " XFS_QUOTA_??? " ) ;
2016-09-27 04:08:38 +03:00
PRINT_FIELD_U ( " , " , dq , qs_incoredqs ) ;
PRINT_FIELD_U ( " , qs_uquota={ " , dq . qs_uquota , qfs_ino ) ;
PRINT_FIELD_U ( " , " , dq . qs_uquota , qfs_nblks ) ;
PRINT_FIELD_U ( " , " , dq . qs_uquota , qfs_nextents ) ;
PRINT_FIELD_U ( " }, qs_gquota={ " , dq . qs_gquota , qfs_ino ) ;
PRINT_FIELD_U ( " , " , dq . qs_gquota , qfs_nblks ) ;
PRINT_FIELD_U ( " , " , dq . qs_gquota , qfs_nextents ) ;
PRINT_FIELD_U ( " }, qs_pquota={ " , dq . qs_pquota , qfs_ino ) ;
PRINT_FIELD_U ( " , " , dq . qs_pquota , qfs_nblks ) ;
PRINT_FIELD_U ( " , " , dq . qs_pquota , qfs_nextents ) ;
PRINT_FIELD_D ( " }, " , dq , qs_btimelimit ) ;
PRINT_FIELD_D ( " , " , dq , qs_itimelimit ) ;
PRINT_FIELD_D ( " , " , dq , qs_rtbtimelimit ) ;
PRINT_FIELD_U ( " , " , dq , qs_bwarnlimit ) ;
PRINT_FIELD_U ( " , " , dq , qs_iwarnlimit ) ;
} else {
tprints ( " , ... " ) ;
2006-10-16 04:26:47 +04:00
}
2016-09-27 04:08:38 +03:00
tprints ( " } " ) ;
2016-09-21 06:11:17 +03:00
break ;
}
case Q_XQUOTAON :
case Q_XQUOTAOFF :
{
uint32_t flag ;
tprints ( " , " ) ;
if ( umove_or_printaddr ( tcp , data , & flag ) )
2006-10-16 04:26:47 +04:00
break ;
2016-09-21 06:11:17 +03:00
tprints ( " [ " ) ;
printflags ( xfs_quota_flags , flag , " XFS_QUOTA_??? " ) ;
tprints ( " ] " ) ;
break ;
}
2016-09-21 06:11:52 +03:00
case Q_XQUOTARM :
{
uint32_t flag ;
tprints ( " , " ) ;
if ( umove_or_printaddr ( tcp , data , & flag ) )
break ;
tprints ( " [ " ) ;
printflags ( xfs_dqblk_flags , flag , " XFS_???_QUOTA " ) ;
tprints ( " ] " ) ;
break ;
}
2016-09-21 06:11:17 +03:00
default :
printuid ( " , " , id ) ;
tprints ( " , " ) ;
printaddr ( data ) ;
break ;
2006-10-16 04:26:47 +04:00
}
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 04:15:49 +03:00
return RVAL_DECODED ;
2006-10-16 04:26:47 +04:00
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( quotactl )
2006-10-16 04:26:47 +04:00
{
/*
* The Linux kernel only looks at the low 32 bits of command and id
* arguments , but on some 64 - bit architectures ( s390x ) this word
* will have been sign - extended when we see it . The high 1 bits
* don ' t mean anything , so don ' t confuse the output with them .
*/
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-17 01:50:09 +03:00
uint32_t qcmd = tcp - > u_arg [ 0 ] ;
uint32_t cmd = QCMD_CMD ( qcmd ) ;
uint32_t type = QCMD_TYPE ( qcmd ) ;
uint32_t id = tcp - > u_arg [ 2 ] ;
2006-10-16 04:26:47 +04:00
2011-06-22 16:32:43 +04:00
if ( entering ( tcp ) ) {
2016-09-21 06:10:46 +03:00
tprints ( " QCMD( " ) ;
2006-10-16 04:26:47 +04:00
printxval ( quotacmds , cmd , " Q_??? " ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2016-09-21 06:10:46 +03:00
printxval ( quotatypes , type , " ???QUOTA " ) ;
tprints ( " ), " ) ;
2012-10-27 03:43:13 +04:00
printpath ( tcp , tcp - > u_arg [ 1 ] ) ;
2006-10-16 04:26:47 +04:00
}
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-21 06:11:09 +03:00
return decode_cmd_data ( tcp , id , cmd , tcp - > u_arg [ 3 ] ) ;
2006-10-16 04:26:47 +04:00
}