From 6c4a4bfe13b47d3e0010e6773c24b81a2b209144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Wed, 27 Dec 2023 14:15:07 +0800 Subject: [PATCH] Disk (macOS): support name detection of iso volumes --- src/detection/disk/disk_bsd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/detection/disk/disk_bsd.c b/src/detection/disk/disk_bsd.c index f885563d1..6f04ce37b 100644 --- a/src/detection/disk/disk_bsd.c +++ b/src/detection/disk/disk_bsd.c @@ -26,10 +26,10 @@ static void detectFsInfo(struct statfs* fs, FFDisk* disk) #include #include -struct VolAttrBuf { +struct CmnAttrBuf { uint32_t length; - attrreference_t volNameRef; - char volNameSpace[MAXPATHLEN]; + attrreference_t nameRef; + char nameSpace[NAME_MAX * 3 + 1]; } __attribute__((aligned(4), packed)); void detectFsInfo(struct statfs* fs, FFDisk* disk) @@ -41,12 +41,12 @@ void detectFsInfo(struct statfs* fs, FFDisk* disk) else disk->type = FF_DISK_VOLUME_TYPE_REGULAR_BIT; - struct VolAttrBuf attrBuf; + struct CmnAttrBuf attrBuf; if (getattrlist(disk->mountpoint.chars, &(struct attrlist) { .bitmapcount = ATTR_BIT_MAP_COUNT, - .volattr = ATTR_VOL_INFO | ATTR_VOL_NAME, + .commonattr = ATTR_CMN_NAME, }, &attrBuf, sizeof(attrBuf), 0) == 0) - ffStrbufInitNS(&disk->name, attrBuf.volNameRef.attr_length - 1 /* excluding '\0' */, attrBuf.volNameSpace); + ffStrbufInitNS(&disk->name, attrBuf.nameRef.attr_length - 1 /* excluding '\0' */, attrBuf.nameSpace); } #endif