[vlc-commits] [Git][videolan/vlc][3.0.x] 3 commits: smb2: prefix local functions with vlc_

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Apr 17 14:40:44 UTC 2026



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
aac8ed80 by Thomas Guillem at 2026-04-17T13:43:45+00:00
smb2: prefix local functions with vlc_

To avoid conflicts with smb2.h

(cherry picked from commit 9adc93c1a52e02c78d395660a52d4e276c49ee1f)

- - - - -
a8703ccc by Thomas Guillem at 2026-04-17T13:43:45+00:00
smb2: rework ShareEnum

To prepare for the next commit.

(cherry picked from commit 94db6cdc13b58c50dd98836e6e9aeec92851dbe7)

- - - - -
70a28975 by Thomas Guillem at 2026-04-17T13:43:45+00:00
smb2: update latest net share API

(cherry picked from commit 8c8c28be69349435171f5bee237b807cee2b017d)

- - - - -


1 changed file:

- modules/access/smb2.c


Changes:

=====================================
modules/access/smb2.c
=====================================
@@ -117,7 +117,11 @@ struct access_sys
     struct smb2_context *   smb2;
     struct smb2fh *         smb2fh;
     struct smb2dir *        smb2dir;
+#ifdef LIBSMB2_SHARE_ENUM_V2
+    struct srvsvc_NetrShareEnum_rep *share_enum;
+#else
     struct srvsvc_netshareenumall_rep *share_enum;
+#endif
     uint64_t                smb2_size;
     vlc_url_t               encoded_url;
     bool                    eof;
@@ -161,7 +165,7 @@ vlc_smb2_op_reset(struct vlc_smb2_op *op, struct smb2_context **smb2p)
 }
 
 static int
-smb2_check_status(struct vlc_smb2_op *op, const char *psz_func, int status)
+vlc_smb2_check_status(struct vlc_smb2_op *op, const char *psz_func, int status)
 {
     if (status < 0)
     {
@@ -179,12 +183,12 @@ smb2_check_status(struct vlc_smb2_op *op, const char *psz_func, int status)
 }
 
 static void
-smb2_set_error(struct vlc_smb2_op *op, const char *psz_func, int err)
+vlc_smb2_set_error(struct vlc_smb2_op *op, const char *psz_func, int err)
 {
     if (op->log && err != -EINTR)
         msg_Err(op->log, "%s failed: %d, %s", psz_func, err, smb2_get_error(op->smb2));
 
-    /* Don't override if set via smb2_check_status */
+    /* Don't override if set via vlc_smb2_check_status */
     if (op->error_status == 0)
         op->error_status = err;
 
@@ -194,10 +198,10 @@ smb2_set_error(struct vlc_smb2_op *op, const char *psz_func, int err)
 }
 
 #define VLC_SMB2_CHECK_STATUS(op, status) \
-    smb2_check_status(op, __func__, status)
+    vlc_smb2_check_status(op, __func__, status)
 
 #define VLC_SMB2_SET_ERROR(op, func, err) \
-    smb2_set_error(op, func, err)
+    vlc_smb2_set_error(op, func, err)
 
 #define VLC_SMB2_STATUS_DENIED(x) (x == -ECONNREFUSED || x == -EACCES)
 
@@ -501,17 +505,33 @@ ShareEnum(stream_t *access, input_item_node_t *p_node)
     struct vlc_readdir_helper rdh;
     vlc_readdir_helper_init(&rdh, access, p_node);
 
+#ifdef LIBSMB2_SHARE_ENUM_V2
+    struct srvsvc_SHARE_INFO_1_CONTAINER *ctr = &sys->share_enum->ses.ShareInfo.Level1;
+    size_t ctr_count = ctr->EntriesRead;
+#else
     struct srvsvc_netsharectr *ctr = sys->share_enum->ctr;
+    size_t ctr_count = ctr->ctr1.count;
+#endif
+
     for (uint32_t iinfo = 0;
-         iinfo < ctr->ctr1.count && ret == VLC_SUCCESS; ++iinfo)
+         iinfo < ctr_count && ret == VLC_SUCCESS; ++iinfo)
     {
+#ifdef LIBSMB2_SHARE_ENUM_V2
+       struct srvsvc_SHARE_INFO_1 *info = &ctr->Buffer->share_info_1[iinfo];
+       const char *name = info->netname.utf8;
+       uint32_t type = info->type;
+#else
        struct srvsvc_netshareinfo1 *info = &ctr->ctr1.array[iinfo];
-       if (info->type & SHARE_TYPE_HIDDEN)
+       const char *name = info->name;
+       uint32_t type = info->type;
+#endif
+
+       if (type & SHARE_TYPE_HIDDEN)
            continue;
-       switch (info->type & 0x3)
+       switch (type & 0x3)
        {
            case SHARE_TYPE_DISKTREE:
-               ret = AddItem(access, &rdh, info->name, ITEM_TYPE_DIRECTORY);
+               ret = AddItem(access, &rdh, name, ITEM_TYPE_DIRECTORY);
                break;
        }
     }
@@ -603,7 +623,13 @@ vlc_smb2_open_share(stream_t *access, struct smb2_context **smb2p,
 
     int ret;
     if (do_enum)
+    {
+#ifdef LIBSMB2_SHARE_ENUM_V2
+        ret = smb2_share_enum_async(op.smb2, SHARE_INFO_1, smb2_open_cb, &op);
+#else
         ret = smb2_share_enum_async(op.smb2, smb2_open_cb, &op);
+#endif
+    }
     else
     {
         ret = smb2_stat_async(op.smb2, smb2_url->path, &smb2_stat,



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ee9d85e1d2de0da4456d2c03b39d706eed0527b0...70a289756e150b3833a76ef10e263351212f6e13

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ee9d85e1d2de0da4456d2c03b39d706eed0527b0...70a289756e150b3833a76ef10e263351212f6e13
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list