|
|
|
@ -450,7 +450,6 @@ bitflags::bitflags! {
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
|
pub struct LinkOrder {
|
|
|
|
|
pub(crate) link_ref: LinkRef,
|
|
|
|
|
pub(crate) expected_revision: Option<u64>,
|
|
|
|
|
pub(crate) flags: MprogFlags,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -460,7 +459,6 @@ impl Default for LinkOrder {
|
|
|
|
|
Self {
|
|
|
|
|
link_ref: LinkRef::Fd(0),
|
|
|
|
|
flags: MprogFlags::AFTER,
|
|
|
|
|
expected_revision: None,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -471,7 +469,6 @@ impl LinkOrder {
|
|
|
|
|
Self {
|
|
|
|
|
link_ref: LinkRef::Id(0),
|
|
|
|
|
flags: MprogFlags::BEFORE,
|
|
|
|
|
expected_revision: None,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -480,7 +477,6 @@ impl LinkOrder {
|
|
|
|
|
Self {
|
|
|
|
|
link_ref: LinkRef::Id(0),
|
|
|
|
|
flags: MprogFlags::AFTER,
|
|
|
|
|
expected_revision: None,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -489,7 +485,6 @@ impl LinkOrder {
|
|
|
|
|
Ok(Self {
|
|
|
|
|
link_ref: LinkRef::Fd(link.fd()?.as_raw_fd()),
|
|
|
|
|
flags: MprogFlags::BEFORE | MprogFlags::LINK,
|
|
|
|
|
expected_revision: None,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -498,7 +493,6 @@ impl LinkOrder {
|
|
|
|
|
Ok(Self {
|
|
|
|
|
link_ref: LinkRef::Fd(link.fd()?.as_raw_fd()),
|
|
|
|
|
flags: MprogFlags::AFTER | MprogFlags::LINK,
|
|
|
|
|
expected_revision: None,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -507,7 +501,6 @@ impl LinkOrder {
|
|
|
|
|
Ok(Self {
|
|
|
|
|
link_ref: LinkRef::Id(id.0),
|
|
|
|
|
flags: MprogFlags::BEFORE | MprogFlags::LINK | MprogFlags::ID,
|
|
|
|
|
expected_revision: None,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -516,7 +509,6 @@ impl LinkOrder {
|
|
|
|
|
Ok(Self {
|
|
|
|
|
link_ref: LinkRef::Id(id.0),
|
|
|
|
|
flags: MprogFlags::AFTER | MprogFlags::LINK | MprogFlags::ID,
|
|
|
|
|
expected_revision: None,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -525,7 +517,6 @@ impl LinkOrder {
|
|
|
|
|
Ok(Self {
|
|
|
|
|
link_ref: LinkRef::Fd(program.fd()?.as_raw_fd()),
|
|
|
|
|
flags: MprogFlags::BEFORE,
|
|
|
|
|
expected_revision: None,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -534,7 +525,6 @@ impl LinkOrder {
|
|
|
|
|
Ok(Self {
|
|
|
|
|
link_ref: LinkRef::Fd(program.fd()?.as_raw_fd()),
|
|
|
|
|
flags: MprogFlags::AFTER,
|
|
|
|
|
expected_revision: None,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -543,7 +533,6 @@ impl LinkOrder {
|
|
|
|
|
Self {
|
|
|
|
|
link_ref: LinkRef::Id(id.0),
|
|
|
|
|
flags: MprogFlags::BEFORE | MprogFlags::ID,
|
|
|
|
|
expected_revision: None,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -552,17 +541,8 @@ impl LinkOrder {
|
|
|
|
|
Self {
|
|
|
|
|
link_ref: LinkRef::Id(id.0),
|
|
|
|
|
flags: MprogFlags::AFTER | MprogFlags::ID,
|
|
|
|
|
expected_revision: None,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// set the expected revision for the link, the revision changes
|
|
|
|
|
/// with each modification of the list of attached programs. User space
|
|
|
|
|
/// can pass an expected revision when creating a new link. The kernel
|
|
|
|
|
/// then rejects the update if the revision has changed.
|
|
|
|
|
pub fn set_expected_revision(&mut self, revision: u64) {
|
|
|
|
|
self.expected_revision = Some(revision);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
|