[PATCH v3 2/2] Cygwin: expose all windows volume mount points.

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Feb 12 21:20:08 GMT 2025


Hi Jeremy,

your patch is basically fine, and I was about to push it, when I
realized that I don't quite understand this:

On Feb 12 10:56, Jeremy Drake via Cygwin-patches wrote:
>  struct mntent *
>  mount_info::getmntent (int x)
>  {
>    if (x < 0 || x >= nmounts)
> -    return cygdrive_getmntent ();
> -
> +    {
> +      struct mntent *ret;
> +      /* de-duplicate against explicit mount entries */
> +      while ((ret = cygdrive_getmntent ()))
> +	{
> +	  for (int i = 0; i < nmounts; ++i)
> +	    {
> +	      int cmp = strcmp (ret->mnt_dir, mount[posix_sorted[i]].posix_path);
> +	      if (!cmp && strcasematch (ret->mnt_fsname,
> +					mount[posix_sorted[i]].native_path))
> +		goto cygdrive_mntent_continue;
> +	      else if (cmp > 0)
> +		break;
> +	    }
> +	  break;
> +cygdrive_mntent_continue:;
> +	}
> +      return ret;
> +    }

What exactly is de-duplicated here?

I have a drive mounted under C:\drvmount.
I create an additional mount entry:

  $ mount C:/drvmount /home/corinna/drv

If I call mount, I see two mount entries, both pointing to the
/home/corinna/drv dir:

  $ mount | grep drvmount
  C:/drvmount on /home/corinna/drv type ntfs (binary,user)
  C:/drvmount on /home/corinna/drv type ntfs (binary,posix=0,noumount,auto)

The first is the explicit mount, the second is the cygdrive entry.
If I disable the above de-dup code, the result is the same.

However, either way, both point to the explicit mount point.
Wouldn't it be helpful to see /cygdrive/c/drvmount?

  C:/drvmount on /home/corinna/drv type ntfs (binary,user)
  C:/drvmount on /cygdrive/c/drvmount type ntfs (binary,posix=0,noumount,auto)


Thanks,
Corinna


More information about the Cygwin-patches mailing list