aboutsummaryrefslogtreecommitdiff
path: root/sys/linux
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2021-12-05 06:53:03 -0800
committerNicholas Noll <nbnoll@eml.cc>2021-12-05 06:53:03 -0800
commit158d9b84f14457136379f42e7c071eb79d87ee6b (patch)
tree1be32a072934357bc8a777f562fd431af9e3229b /sys/linux
parent861897dd86ca96410b1c11a8a9cc3086bbcb054f (diff)
Feat: libbase partitioning. Cleaned up hash map macros.
Additionally, fixed varargs cleanup when done with fmt.write. Some system constants were added to allow for directory walking.
Diffstat (limited to 'sys/linux')
-rw-r--r--sys/linux/port/os/constants.h50
-rw-r--r--sys/linux/src/info.c2
-rw-r--r--sys/linux/src/infofd.c2
3 files changed, 36 insertions, 18 deletions
diff --git a/sys/linux/port/os/constants.h b/sys/linux/port/os/constants.h
index ffe8610..f994a93 100644
--- a/sys/linux/port/os/constants.h
+++ b/sys/linux/port/os/constants.h
@@ -69,19 +69,37 @@
#define sys·InfoForceSync 0x2000
#define sys·InfoNoSync 0x4000
-// masks
-#define sys·InfoType 0x00000001u /* want/got stx_mode & s_ifmt */
-#define sys·InfoMode 0x00000002u /* want/got stx_mode & ~s_ifmt */
-#define sys·InfoNLink 0x00000004u /* want/got stx_nlink */
-#define sys·InfoUid 0x00000008u /* want/got stx_uid */
-#define sys·InfoGid 0x00000010u /* want/got stx_gid */
-#define sys·InfoAccessTime 0x00000020u /* want/got stx_atime */
-#define sys·InfoModifyTime 0x00000040u /* want/got stx_mtime */
-#define sys·InfoChangeTime 0x00000080u /* want/got stx_ctime */
-#define sys·InfoInode 0x00000100u /* want/got stx_ino */
-#define sys·InfoSize 0x00000200u /* want/got stx_size */
-#define sys·InfoBlocks 0x00000400u /* want/got stx_blocks */
-#define sys·InfoBasic 0x000007ffu /* the stuff in the normal stat struct*/
-#define sys·InfoCreateTime 0x00000800u /* want/got stx_btime */
-#define sys·InfoMntId 0x00001000u /* got stx_mnt_id */
-#define sys·InfoAll (sys·InfoBasic|sys·InfoCreateTime)
+// mode masks
+#define sys·InfoWantType 0x00000001u /* want/got stx_mode & s_ifmt */
+#define sys·InfoWantMode 0x00000002u /* want/got stx_mode & ~s_ifmt */
+#define sys·InfoWantNLink 0x00000004u /* want/got stx_nlink */
+#define sys·InfoWantUid 0x00000008u /* want/got stx_uid */
+#define sys·InfoWantGid 0x00000010u /* want/got stx_gid */
+#define sys·InfoWantAccessTime 0x00000020u /* want/got stx_atime */
+#define sys·InfoWantModifyTime 0x00000040u /* want/got stx_mtime */
+#define sys·InfoWantChangeTime 0x00000080u /* want/got stx_ctime */
+#define sys·InfoWantInode 0x00000100u /* want/got stx_ino */
+#define sys·InfoWantSize 0x00000200u /* want/got stx_size */
+#define sys·InfoWantBlocks 0x00000400u /* want/got stx_blocks */
+#define sys·InfoWantBasic 0x000007ffu /* the stuff in the normal stat struct*/
+#define sys·InfoWantCreateTime 0x00000800u /* want/got stx_btime */
+#define sys·InfoWantMntId 0x00001000u /* got stx_mnt_id */
+#define sys·InfoWantAll (sys·InfoWantBasic|sys·InfoWantCreateTime)
+
+// helpers
+#define sys·InfoMaskType 0170000
+#define sys·InfoDirType 0040000
+#define sys·InfoCharType 0020000
+#define sys·InfoBlockType 0060000
+#define sys·InfoFileType 0100000
+#define sys·InfoFifoType 0010000
+#define sys·InfoLinkType 0120000
+#define sys·InfoSocketType 0140000
+
+#define sys·InfoIsDir(mode) (((mode) & sys·InfoMaskType) == sys·InfoDirType)
+#define sys·InfoIsChar(mode) (((mode) & sys·InfoMaskType) == sys·InfoCharType)
+#define sys·InfoIsBlock(mode) (((mode) & sys·InfoMaskType) == sys·InfoBlockType)
+#define sys·InfoIsFile(mode) (((mode) & sys·InfoMaskType) == sys·InfoFileType)
+#define sys·InfoIsFifo(mode) (((mode) & sys·InfoMaskType) == sys·InfoFifoType)
+#define sys·InfoIsLink(mode) (((mode) & sys·InfoMaskType) == sys·InfoLinkType)
+#define sys·InfoIsSocket(mode) (((mode) & sys·InfoMaskType) == sys·InfoSocketType)
diff --git a/sys/linux/src/info.c b/sys/linux/src/info.c
index 60f32a0..81b85b9 100644
--- a/sys/linux/src/info.c
+++ b/sys/linux/src/info.c
@@ -3,5 +3,5 @@
int
sys·info(char *path, sys·Info *file)
{
- return sys·infoat(sys·FdCwd, path, 0, sys·InfoAll, file);
+ return sys·infoat(sys·FdCwd, path, 0, sys·InfoWantAll, file);
}
diff --git a/sys/linux/src/infofd.c b/sys/linux/src/infofd.c
index 770009a..2c22c72 100644
--- a/sys/linux/src/infofd.c
+++ b/sys/linux/src/infofd.c
@@ -5,5 +5,5 @@ sys·infofd(int fd, sys·Info *file)
{
if(fd < 0)
return sys·ErrorBadFd;
- return sys·infoat(fd, "", sys·AtEmptyPath, sys·InfoAll, file);
+ return sys·infoat(fd, "", sys·AtEmptyPath, sys·InfoWantAll, file);
}