| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | $NetBSD: patch-ab,v 1.6 2010/03/21 14:49:10 taca Exp $ | | 1 | $NetBSD: patch-ab,v 1.7 2010/04/21 05:34:31 taca Exp $ |
2 | | | 2 | |
3 | --- quota.c.orig 2002-03-30 14:59:12.000000000 +0000 | | 3 | --- quota.c.orig 2002-03-30 14:59:12.000000000 +0000 |
4 | +++ quota.c | | 4 | +++ quota.c |
5 | @@ -5,9 +5,13 @@ | | 5 | @@ -5,9 +5,13 @@ |
6 | | | 6 | |
7 | #include "ruby.h" | | 7 | #include "ruby.h" |
8 | | | 8 | |
9 | -#define RUBY_QUOTA_VERSION "0.4.1" | | 9 | -#define RUBY_QUOTA_VERSION "0.4.1" |
10 | +#define RUBY_QUOTA_VERSION "0.5.1" | | 10 | +#define RUBY_QUOTA_VERSION "0.5.1" |
11 | | | 11 | |
12 | -#ifdef HAVE_LINUX_QUOTA_H /* for linux-2.4.x */ | | 12 | -#ifdef HAVE_LINUX_QUOTA_H /* for linux-2.4.x */ |
13 | +#ifdef HAVE_UNISTD_H | | 13 | +#ifdef HAVE_UNISTD_H |
14 | +#include <unistd.h> | | 14 | +#include <unistd.h> |
| @@ -39,81 +39,89 @@ $NetBSD: patch-ab,v 1.6 2010/03/21 14:49 | | | @@ -39,81 +39,89 @@ $NetBSD: patch-ab,v 1.6 2010/03/21 14:49 |
39 | @@ -51,6 +61,12 @@ | | 39 | @@ -51,6 +61,12 @@ |
40 | #if defined(SYS_UCRED_H) | | 40 | #if defined(SYS_UCRED_H) |
41 | # include <sys/ucred.h> /* required by NetBSD,FreeBSD */ | | 41 | # include <sys/ucred.h> /* required by NetBSD,FreeBSD */ |
42 | #endif | | 42 | #endif |
43 | +#if defined(__DragonFly__) | | 43 | +#if defined(__DragonFly__) |
44 | +# include <sys/param.h> | | 44 | +# include <sys/param.h> |
45 | +# if __DragonFly_version >= 160000 | | 45 | +# if __DragonFly_version >= 160000 |
46 | +# define dqblk ufs_dqblk | | 46 | +# define dqblk ufs_dqblk |
47 | +# endif | | 47 | +# endif |
48 | +#endif | | 48 | +#endif |
49 | #endif | | 49 | #endif |
50 | | | 50 | |
51 | static VALUE rb_mQuota; | | 51 | static VALUE rb_mQuota; |
52 | @@ -159,7 +175,11 @@ rb_quotactl(int cmd, char *dev, VALUE vu | | 52 | @@ -144,7 +160,6 @@ rb_quotactl(int cmd, char *dev, VALUE vu |
| | | 53 | uid_t uid; |
| | | 54 | |
| | | 55 | get_uid(vuid, &uid, &is_gid); |
| | | 56 | - printf("cmd = %d, dev = %s, uid = %d, gid? = %d\n", cmd, dev, uid, is_gid); |
| | | 57 | if( is_gid ){ |
| | | 58 | return quotactl(QCMD(cmd,GRPQUOTA),dev,(qid_t)uid,addr); |
| | | 59 | } |
| | | 60 | @@ -159,7 +174,11 @@ rb_quotactl(int cmd, char *dev, VALUE vu |
53 | char *path; | | 61 | char *path; |
54 | int is_gid; | | 62 | int is_gid; |
55 | uid_t uid; | | 63 | uid_t uid; |
56 | +#if defined(HAVE_SYS_STATVFS_H) && !defined(__DragonFly__) | | 64 | +#if defined(HAVE_SYS_STATVFS_H) && !defined(__DragonFly__) |
57 | + struct statvfs *buff; | | 65 | + struct statvfs *buff; |
58 | +#else | | 66 | +#else |
59 | struct statfs *buff; | | 67 | struct statfs *buff; |
60 | +#endif | | 68 | +#endif |
61 | int i, count, ret; | | 69 | int i, count, ret; |
62 | | | 70 | |
63 | buff = 0; | | 71 | buff = 0; |
64 | @@ -187,12 +207,16 @@ rb_quotactl(int cmd, char *dev, VALUE vu | | 72 | @@ -187,12 +206,16 @@ rb_quotactl(int cmd, char *dev, VALUE vu |
65 | static int | | 73 | static int |
66 | rb_quotactl(int cmd, char *dev, VALUE vuid, caddr_t addr) | | 74 | rb_quotactl(int cmd, char *dev, VALUE vuid, caddr_t addr) |
67 | { | | 75 | { |
68 | - struct quotctl qctl = {cmd, uid, addr}; | | 76 | - struct quotctl qctl = {cmd, uid, addr}; |
69 | + struct quotctl qctl; | | 77 | + struct quotctl qctl; |
70 | int fd; | | 78 | int fd; |
71 | uid_t uid; | | 79 | uid_t uid; |
72 | | | 80 | |
73 | get_uid(vuid, &uid, 0); | | 81 | get_uid(vuid, &uid, 0); |
74 | | | 82 | |
75 | + qctl.op = cmd; | | 83 | + qctl.op = cmd; |
76 | + qctl.uid = uid; | | 84 | + qctl.uid = uid; |
77 | + qctl.addr = addr; | | 85 | + qctl.addr = addr; |
78 | + | | 86 | + |
79 | switch( cmd ){ | | 87 | switch( cmd ){ |
80 | case Q_QUOTAON: | | 88 | case Q_QUOTAON: |
81 | case Q_QUOTAOFF: | | 89 | case Q_QUOTAOFF: |
82 | @@ -235,7 +259,9 @@ rb_diskquota_get(VALUE dqb, struct dqblk | | 90 | @@ -235,7 +258,9 @@ rb_diskquota_get(VALUE dqb, struct dqblk |
83 | #if defined(USE_LINUX_QUOTA) | | 91 | #if defined(USE_LINUX_QUOTA) |
84 | c_dqb->dqb_bhardlimit = GetMember("bhardlimit"); | | 92 | c_dqb->dqb_bhardlimit = GetMember("bhardlimit"); |
85 | c_dqb->dqb_bsoftlimit = GetMember("bsoftlimit"); | | 93 | c_dqb->dqb_bsoftlimit = GetMember("bsoftlimit"); |
86 | -#if !defined(USE_LINUX_QUOTA_24) | | 94 | -#if !defined(USE_LINUX_QUOTA_24) |
87 | +#if defined(USE_LINUX_QUOTA_24) || defined(USE_LINUX_QUOTA_26) | | 95 | +#if defined(USE_LINUX_QUOTA_24) || defined(USE_LINUX_QUOTA_26) |
88 | + c_dqb->dqb_curspace = GetMember("curspace"); | | 96 | + c_dqb->dqb_curspace = GetMember("curspace"); |
89 | +#else | | 97 | +#else |
90 | c_dqb->dqb_curblocks = GetMember("curblocks"); | | 98 | c_dqb->dqb_curblocks = GetMember("curblocks"); |
91 | #endif | | 99 | #endif |
92 | c_dqb->dqb_ihardlimit = GetMember("ihardlimit"); | | 100 | c_dqb->dqb_ihardlimit = GetMember("ihardlimit"); |
93 | @@ -274,7 +300,7 @@ rb_diskquota_new(struct dqblk *c_dqb) | | 101 | @@ -274,7 +299,7 @@ rb_diskquota_new(struct dqblk *c_dqb) |
94 | dqb = rb_struct_new(rb_sDiskQuota, | | 102 | dqb = rb_struct_new(rb_sDiskQuota, |
95 | UINT2NUM(c_dqb->dqb_bhardlimit), | | 103 | UINT2NUM(c_dqb->dqb_bhardlimit), |
96 | UINT2NUM(c_dqb->dqb_bsoftlimit), | | 104 | UINT2NUM(c_dqb->dqb_bsoftlimit), |
97 | -#if defined(USE_LINUX_QUOTA_24) | | 105 | -#if defined(USE_LINUX_QUOTA_24) |
98 | +#if defined(USE_LINUX_QUOTA_24) || defined(USE_LINUX_QUOTA_26) | | 106 | +#if defined(USE_LINUX_QUOTA_24) || defined(USE_LINUX_QUOTA_26) |
99 | UINT2NUM(c_dqb->dqb_curspace), | | 107 | UINT2NUM(c_dqb->dqb_curspace), |
100 | #else | | 108 | #else |
101 | UINT2NUM(c_dqb->dqb_curblocks), | | 109 | UINT2NUM(c_dqb->dqb_curblocks), |
102 | @@ -442,7 +468,7 @@ Init_quota() | | 110 | @@ -442,7 +467,7 @@ Init_quota() |
103 | "curinodes", | | 111 | "curinodes", |
104 | "btimelimit", | | 112 | "btimelimit", |
105 | "itimelimit", | | 113 | "itimelimit", |
106 | - 0); | | 114 | - 0); |
107 | + NULL); | | 115 | + NULL); |
108 | | | 116 | |
109 | /* for compatibility */ | | 117 | /* for compatibility */ |
110 | #define DQ_ALIAS(a,b) rb_alias(rb_sDiskQuota,rb_intern(#a),rb_intern(#b)) | | 118 | #define DQ_ALIAS(a,b) rb_alias(rb_sDiskQuota,rb_intern(#a),rb_intern(#b)) |
111 | @@ -454,7 +480,7 @@ Init_quota() | | 119 | @@ -454,7 +479,7 @@ Init_quota() |
112 | DQ_ALIAS(fsoftlimit=, isoftlimit=); | | 120 | DQ_ALIAS(fsoftlimit=, isoftlimit=); |
113 | DQ_ALIAS(curfiles=, curinodes=); | | 121 | DQ_ALIAS(curfiles=, curinodes=); |
114 | DQ_ALIAS(ftimelimit=, itimelimit=); | | 122 | DQ_ALIAS(ftimelimit=, itimelimit=); |
115 | -#if defined(USE_LINUX_QUOTA_24) | | 123 | -#if defined(USE_LINUX_QUOTA_24) |
116 | +#if defined(USE_LINUX_QUOTA_24) || defined(USE_LINUX_QUOTA_26) | | 124 | +#if defined(USE_LINUX_QUOTA_24) || defined(USE_LINUX_QUOTA_26) |
117 | DQ_ALIAS(curspace, curblocks); | | 125 | DQ_ALIAS(curspace, curblocks); |
118 | DQ_ALIAS(curspace=, curblocks=); | | 126 | DQ_ALIAS(curspace=, curblocks=); |
119 | #endif | | 127 | #endif |