minor cleanups
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Wed, 2 Mar 2005 01:23:38 +0000 (01:23 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Wed, 2 Mar 2005 01:23:38 +0000 (01:23 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@1877 94cd875c-1c1d-0410-91d2-eb244daf1a30

util-vserver/lib/syscall_adddlimit-v13.hc
util-vserver/lib/syscall_remdlimit-v13.hc
util-vserver/lib/vserver-internal.h

index 18e1a79..b3d9825 100644 (file)
 static inline ALWAYSINLINE int
 vc_add_dlimit_v13(char const *filename, xid_t xid, uint32_t flags)
 {
-  struct vcmd_ctx_dlimit_base_v0       init;
+  struct vcmd_ctx_dlimit_base_v0       init = {
+    .name   =  filename,
+    .flags  =  flags
+  };
 
-  memset(&init, 0, sizeof(init));
-  init.name = filename;
-  init.flags = flags;
   return vserver(VCMD_add_dlimit, CTX_USER2KERNEL(xid), &init);
 }
index 38df159..a15a924 100644 (file)
 static inline ALWAYSINLINE int
 vc_rem_dlimit_v13(char const *filename, xid_t xid, uint32_t flags)
 {
-  struct vcmd_ctx_dlimit_base_v0       init;
+  struct vcmd_ctx_dlimit_base_v0       init = {
+    .name  = filename,
+    .flags = flags
+  };
 
-  memset(&init, 0, sizeof(init));
-  init.name = filename;
-  init.flags = flags;
   return vserver(VCMD_rem_dlimit, CTX_USER2KERNEL(xid), &init);
 }
index 90cb7d8..0f58d7e 100644 (file)
                                         (X)==VC_CDLIM_INFINITY ? CDLIM_INFINITY : \
                                         (X)==VC_CDLIM_KEEP     ? CDLIM_KEEP     : \
                                         (X))
-#define CDLIM_KERNEL2USER(X)           ((X)==CDLIM_UNSET       ? VC_CDLIM_UNSET    : \
-                                        (X)==CDLIM_INFINITY    ? VC_CDLIM_INFINITY : \
-                                        (X)==CDLIM_KEEP        ? VC_CDLIM_KEEP     : \
+
+  /// the __typeof__ thing is a hack to deal with the kernel interface
+  /// using an unsigned long long value for a uint32_t type
+#define CDLIM_KERNEL2USER(X)           ((X)==(__typeof__(X))CDLIM_UNSET       ? VC_CDLIM_UNSET    : \
+                                        (X)==(__typeof__(X))CDLIM_INFINITY    ? VC_CDLIM_INFINITY : \
+                                        (X)==(__typeof__(X))CDLIM_KEEP        ? VC_CDLIM_KEEP     : \
                                         (X))