Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "Hamza, Muhammad" <Muhammad_Hamza@mentor.com>
To: Luca Ceresoli <luca.ceresoli@bootlin.com>
Cc: "openembedded-core@lists.openembedded.org"
	<openembedded-core@lists.openembedded.org>,
	"Awan, Arsalan" <Arsalan_Awan@mentor.com>
Subject: RE: [OE-core] [PATCH] udev-extraconf/mount.sh: add LABELs to mountpoints
Date: Tue, 21 Jun 2022 09:07:24 +0000	[thread overview]
Message-ID: <84647e3aeb62401581f6a207577a02ae@mentor.com> (raw)
In-Reply-To: <20220621102038.00b08ff3@booty>

Hi Luca,
I have sent updated patch v2 at mailing list.

Regards,
Hamza

-----Original Message-----
From: Luca Ceresoli <luca.ceresoli@bootlin.com> 
Sent: Tuesday, June 21, 2022 1:21 PM
To: Hamza, Muhammad <Muhammad_Hamza@mentor.com>
Cc: openembedded-core@lists.openembedded.org; Awan, Arsalan <Arsalan_Awan@mentor.com>
Subject: Re: [OE-core] [PATCH] udev-extraconf/mount.sh: add LABELs to mountpoints

Hi Muhammad,

On Mon, 20 Jun 2022 17:26:40 +0500
"Muhammad Hamza" <Muhammad_Hamza@mentor.com> wrote:

> This alters the mountpoints such that if a device has a LABEL or a 
> PARTLABEL, it will be mounted at e.g.:
> 
>   /run/media/$LABEL-<device-node>
>   /run/media/$PARTLABEL-<device-node>
>   /run/media/rootfs-sda2
> 
> otherwise the device will be mounted at e.g.:
> 
>   /run/media/<device-node>
>   /run/media/sda1
> 
> The <device-node> appended with LABEL or PARTLABEL makes sure that the 
> mountpoint is unique, therefore, avoids overlapping mounts.
> 
> Signed-off-by: Arsalan H. Awan <Arsalan_Awan@mentor.com>
> Signed-off-by: Muhammad Hamza <muhammad_hamza@mentor.com>
> ---
>  .../recipes-core/udev/udev-extraconf/mount.sh | 20 
> +++++++++++++++++++  meta/recipes-core/udev/udev-extraconf_1.1.bb  |  
> 2 +-
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
> b/meta/recipes-core/udev/udev-extraconf/mount.sh
> index c8b773bc07..12c6a5af22 100644
> --- a/meta/recipes-core/udev/udev-extraconf/mount.sh
> +++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
> @@ -54,6 +54,16 @@ automount_systemd() {
>          grep "^[[:space:]]*$tmp" /etc/fstab && return
>      done
>  
> +    # Get the LABEL or PARTLABEL
> +    LABEL=`/sbin/blkid | grep "${DEVNAME}:" | grep -o 'LABEL=".*"' | cut -d '"' -f2`
> +    # If the $DEVNAME has a LABEL or a PARTLABEL
> +    if [ -n "$LABEL" ]; then
> +            # Set the mount location dir name to LABEL appended
> +            # with $name e.g. label-sda. That would avoid overlapping
> +            # mounts in case two devices have same LABEL
> +            name="${LABEL}-${name}"
> +    fi
> +
>      [ -d "$MOUNT_BASE/$name" ] || mkdir -p "$MOUNT_BASE/$name"
>  
>      MOUNT="$MOUNT -o silent"
> @@ -94,6 +104,16 @@ automount() {
>  	# configured in fstab
>  	grep -q "^$DEVNAME " /proc/mounts && return
>  
> +        # Get the LABEL or PARTLABEL
> +        LABEL=`/sbin/blkid | grep "${DEVNAME}:" | grep -o 'LABEL=".*"' | cut -d '"' -f2`
> +        # If the $DEVNAME has a LABEL or a PARTLABEL
> +        if [ -n "$LABEL" ]; then
> +                # Set the mount location dir name to LABEL appended
> +                # with $name e.g. label-sda. That would avoid overlapping
> +                # mounts in case two devices have same LABEL
> +                name="${LABEL}-${name}"
> +        fi

This is exactly as above. Can you move the common code to a function?


--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


      reply	other threads:[~2022-06-21  9:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20 12:26 [PATCH] udev-extraconf/mount.sh: add LABELs to mountpoints Muhammad Hamza
2022-06-21  8:20 ` [OE-core] " Luca Ceresoli
2022-06-21  9:07   ` Hamza, Muhammad [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=84647e3aeb62401581f6a207577a02ae@mentor.com \
    --to=muhammad_hamza@mentor.com \
    --cc=Arsalan_Awan@mentor.com \
    --cc=luca.ceresoli@bootlin.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox